import http from "@/common/request.js";

import my, * as mys from './my' 
import user from './user'
import test from './test'

// 配置对象，（推荐使用）
export const apiOptions = {
  ...my,
	...user,
  ...test,
};

// 请求方法（此方法定义的接口，在分页mixin里未做取消，因为获取接口地址比较麻烦）
const apiFunctions = {
	...mys
}

let apis = {};


for(let key in apiOptions) {
  apis[key] = (data = {}, options = {}) => {
    return http.request({ 
      ...apiOptions[key],
      ...options,
      data
    });
  };
}

for(let key in apiFunctions) {
	if(key === 'default') continue;
	apis[key] = apiFunctions[key];
}

export default apis;
